-- @owner: z@wan005
-- @date: 2023/7/12
-- @testpoint: 兼容b库下index作为关键字测试，部分测试点合理报错
--step1:查询关键字;expect:为保留关键字
select * from pg_get_keywords() where word ='index';
--step2:建表，index为列名;expect:报错
drop table if exists t_index0019;
create table t_index0019(
no int,
c_char char,
c_varchar varchar,
c_varcharn varchar(20),
c_charn char(20),
c_varchar2n varchar2(20),
c_ncharn nchar(20),
c_clob clob,
c_text text,
c_name name,
delim text,
index int
);
--step3:index加反引号，强制使用index关键字;expect:成功
drop table if exists t_index0019_01;
create table t_index0019_01(
no int,
c_char char,
c_varchar varchar,
c_varcharn varchar(20),
c_charn char(20),
c_varchar2n varchar2(20),
c_ncharn nchar(20),
c_clob clob,
c_text text,
c_name name,
delim text,
`index` int
);
desc t_index0019_01;
drop table if exists t_index0019_01;

--step4:作为数据库名;expect:报错
create database index dbcompatibility 'B';
--step5:作为外部数据源名;expect:报错
drop data source if exists index;
create data source index;
drop data source if exists index;
--step6:作为自定义函数名;expect:成功
drop function if exists index(i integer);
create function index(i integer)
returns integer
as $$
begin
    return i+1;
end;
$$ language plpgsql;
/
drop function if exists index(i integer);
--step7:作为用户名;expect:报错
create user index password 'Test_123';
